<?php

namespace App\Models\ActivityRecord;

use App\Entities\PrizeLogistics;
use App\Support\Database\Eloquent\UuidModel;

class ActivityRecord extends UuidModel
{
    const EXCHANGED = 1;//已兑换
    const UNEXCHANGED = 0;//未兑换
    protected $fillable = ['id', 'activity_id', 'prize_id', 'name', 'mobile', 'openid', 'number', 'amount', 'address', 'alipay', 'is_exchange', 'coupon'];

    public function activity()
    {
        return $this->belongsTo('App\Models\Activity\Activity', 'activity_id');
    }

    public function prize()
    {
        return $this->belongsTo('App\Models\Prize\Prize', 'prize_id');
    }

    public function participant()
    {
        return $this->belongsTo('App\Models\Participant\Participant', 'openid', 'uniqueid');
    }

    public function logistics()
    {
        return $this->hasOne(PrizeLogistics::class, 'record_id', 'id');
    }
}
